home *** CD-ROM | disk | FTP | other *** search
- # -------------------------------------------------------------------------
- # Trumpet Winsock Login.cmd for MindSpring Enterprises, Inc.
- #
- # This script requires Trumpet Winsock version 1.0b, alpha 19 or later
- #
- #
- # Some things you may wish to modify:
- # $phone - the telephone number to dial
- # $phone2 - alternate telephone number
- # $name - your user ID
- # $init - the initialisation string for your modem
- # %numretries - how often to retry dialling (0 = forever!)
- # %numlogin - how often to retry login (0 = forever!)
- # $badlogin - string returned by host for failed login attempt
- #
- # For the first three of the above, making the value a single space (" ")
- # will cause the script to prompt you for a value.
- #
- # Version 2.00, Karl Auer
- # Version 2.10, Jerry Britton
- #
- # modified for MindSpring by Robert Sanders -- Nov 24, 1994
- # -------------------------------------------------------------------------
-
- # Turn off both echoing of modem "chatter" and display of commands.
- #
- echo on
- #trace on
-
- # User-definable stuff
-
- $defaultnum = "6541300"
- $defaultprefix = ""
- $defaultinit = "AT Z V1 X4"
-
- if ![load $number]
- $number = $defaultnum
- if [query $number "Enter your dial up phone number #1"]
- save $number
- end
- end
- if ![load $number2]
- $number2 = $number
- if [query $number2 "Enter your dial up phone number #2"]
- save $number2
- end
- end
- if ![load $prefix]
- $prefix = $defaultprefix
- if [query $prefix "Enter your dial prefix (e.g. *70 or 1404)"]
- save $prefix
- end
- end
-
- if ![load $musername]
- if [query $musername "Enter your login username"]
- save $musername
- end
- end
- if ![load $mword]
- if [query $mword "Enter your login password"]
- save $mword
- end
- end
-
- if ![load $init]
- $init = $defaultinit
- save $init
- end
-
- # some constants
-
- $userprompt = "ogin:"
- $passprompt = "assword:"
- %numretries = 20
- %numlogin = 3
-
- $phone = $number
- $phone2 = $number2
-
- # -------------------------------------------------------------------------
- #
- # Do not alter anything below this line unless you know what you are doing!
- #
- # -------------------------------------------------------------------------
-
- # Now try to connect.
-
- %attempts = 0
- $result = " "
- repeat
- # count our attempts
- %attempts = %attempts + 1
-
- # hang up the modem
- set dtr off
- sleep 1
- set dtr on
-
- ### # reset the modem
- ### display "Resetting modem..."\n
- ### outputecho ATZ\r
- ### if ![input 10 OK\n]
- ### display "Can't reset modem. Aborting script."\n
- ### display \7
- ### abort
- ### end
-
- # reinitialise the modem
- display "Initialising modem...("$init")"\n
- output $init\13
- if ![input 10 OK\n]
- display "Can't initialise modem. Aborting script."\n
- display \7
- abort
- end
-
- # dial out
- if %attempts = 1
- display "Dialling "$prefix$phone"..."
- else
- display "Redialling "$prefix$phone" (attempt #"%attempts")..."
- end
- output "ATDT"$prefix$phone\13
-
- # swap phone numbers
- if $phone2 <> " "
- $temp = $phone
- $phone = $phone2
- $phone2 = $temp
- end
-
- # wait for a connection
- %connected = 0
-
- repeat
- %responded = [read 45 $result]
- until ! %responded | $result <> ""
-
- if %responded
- if $result = "NO DIALTONE"
- display "No dialtone detected."\n
- else
- if $result = "BUSY"
- display "Number is busy."\n
- else
- if $result = "NO CARRIER"
- display "No answer."\n
- else
- %connected = 1
- if %connected
- display "Connect string was: "$result\n
- else
- display "No data carrier detect signal..."$result\n
- end
- end
- end
- end
- else
- display "No answer."\n
- end
- until %connected | %attempts = %numretries
-
- # If we didn't get a connection, quit the script
-
- if ! %connected
- display "Unable to connect."\n
- display \7
- abort
- end
-
- # We are now connected.
-
- display "Connected. Negotiating logon:"\n
-
- # Prod the terminal server to wake it up.
- # output \r
-
- # Attempt login, prompting for password with each attempt.
-
- %login = 0
- %attempts = 0
- repeat
- # count our attempts
- %attempts = %attempts + 1
-
- # display " - supplying user ID..."\n
- input 30 $userprompt
- output $musername\13
-
- # Wait for the password prompt, then pass the password on to the terminal
- # server.
-
- # display " - supplying password..."\n
- input 30 $passprompt
- output $mword\13
-
- %login = 1
- if ![input 60 acket mode]
- display "Connected but session not initiated."\n
- %login = 0
- end
- until %login | %attempts = %numlogin
-
-
- if ! %login
- display "Login failed. Hanging up"\n
- display \7
- set dtr off
- sleep 1
- output +++
- if [input 2 OK\n]
- output ATH0\n
- input 10 OK\n
- end
- abort
- end
-
- # Finish up.
-
- display \n
- display "Ready."\n
-
- # All done.
- # END OF SCRIPT
-